package com.lgj.web.sys.service.impl;

import com.lgj.web.sys.mapper.SysResourceCategoryMapper;
import com.lgj.web.sys.model.SysResourceCategory;
import com.lgj.web.sys.service.SysResourceCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 后台资源分类管理Service实现类
 * Created by macro on 2020/2/5.
 */
@Service
public class SysResourceCategoryServiceImpl implements SysResourceCategoryService {
    @Autowired
    private SysResourceCategoryMapper resourceCategoryMapper;

    @Override
    public List<SysResourceCategory> listAll() {
        return resourceCategoryMapper.selectAll();
    }

    @Override
    public int create(SysResourceCategory SysResourceCategory) {
        SysResourceCategory.setCreateTime(new Date());
        return resourceCategoryMapper.insert(SysResourceCategory);
    }

    @Override
    public int update(Long id, SysResourceCategory SysResourceCategory) {
        SysResourceCategory.setId(id);
        return resourceCategoryMapper.updateByPrimaryKeySelective(SysResourceCategory);
    }

    @Override
    public int delete(Long id) {
        return resourceCategoryMapper.deleteByPrimaryKey(id);
    }
}
